﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebClient
{
    public partial class Personal : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack) {
                DTO.Users item;
                if (Session["users"] != null)
                {
                    item = (DTO.Users)Session["users"];
                    txtaddress.Text = item.address;
                    txtemail.Text = item.email;
                    txtfullName.Text = item.fullName;
                    txtphone.Text = item.phone;
                    txtuserName.Text = item.userName;
                    
                }
            }
        }

        protected void btnAddNew_Click(object sender, EventArgs e)
        {
            DTO.Users item;
            if (Session["users"] != null)
            {
                item = (DTO.Users)Session["users"];
                item.address = txtaddress.Text;
                item.email = txtemail.Text;
                item.fullName = txtfullName.Text;
                item.phone = txtphone.Text;
                item.userName = txtuserName.Text;
                WebData db = new WebData();
                db.OnSubmitUsers(item, 1);
            }
        }
    }
}